package org.lds.hotkey.console.component;

import org.lds.hotkey.common.util.ScheduledUtil;
import org.lds.hotkey.console.business.currhotkey.service.CurrHotKeyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

@Component
public class ClearExpiredDataRunner implements ApplicationRunner {

    @Autowired
    private CurrHotKeyService currHotKeyService;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        ScheduledUtil.defaultScheduled(() -> execute());
    }

    private void execute() {
        currHotKeyService.clearExpiredData();
    }
}
